using System;
using System.Data;
using System.Configuration;
using System.Web;

namespace Danser_Entity.Queries.Filters
{
    /// <summary>
    /// Represents a building block of a rule expression 
    /// </summary>
    public class Condition
    {
        #region Members:

        private Groups _group;
        private string _field = "";
        private ComparingOperators _operator;
        private string _value = "";
        private BooleanOperators _boolOperator;
        private bool _not = false;

        //metadata
        private bool _isFirst = false;

        #endregion

        #region C'tor

        /// <summary>
        /// creates an empty Condition instance
        /// </summary>
        public Condition()
        {
        }

        /// <summary>
        /// creates a Condition instance with the given parameters
        /// </summary>
        /// <param name="g"></param>
        /// <param name="f"></param>
        /// <param name="op"></param>
        /// <param name="val"></param>
        /// <param name="bOp"></param>
        /// <param name="not"></param>
        public Condition(Groups group, string field, ComparingOperators op, string value, BooleanOperators bOp, bool not)
        {
            _group = group;
            _field = field;
            _operator = op;
            _value = value;
            _boolOperator = bOp;
            _not = not;
        }

        #endregion

        #region Properties:

        /// <summary>
        /// property - gets or sets the Group member
        /// </summary>
        public Groups Group
        {
            get { return _group; }
            set { _group = value; }
        }

        /// <summary>
        /// property - gets or sets the Field member
        /// </summary>
        public string Field
        {
            get { return _field; }
            set { _field = value; }
        }

        /// <summary>
        /// property - gets or sets the Operator member
        /// </summary>
        public ComparingOperators Operator
        {
            get { return _operator; }
            set { _operator = value; }
        }

        /// <summary>
        /// property - gets or sets the Value member
        /// </summary>
        public string Value
        {
            get { return _value; }
            set { _value = value; }
        }

        /// <summary>
        /// property - gets or sets the BoolOperator member
        /// </summary>
        public BooleanOperators BoolOperator
        {
            get { return _boolOperator; }
            set { _boolOperator = value; }
        }

        /// <summary>
        /// property - gets or sets the Not member
        /// </summary>
        public bool Not
        {
            get { return _not; }
            set { _not = value; }
        }

        /// <summary>
        /// property - gets or sets the IsFirst member
        /// </summary>
        public bool IsFirst
        {
            get { return _isFirst; }
            set { _isFirst = value; }
        }

        #endregion
    }

}
